package com.ruoyi.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.LPaymethodMapper;
import com.ruoyi.system.domain.LPaymethod;
import com.ruoyi.system.service.ILPaymethodService;

import static com.ruoyi.common.utils.SecurityUtils.getUserId;

/**
 * 支付Service业务层处理
 *
 * @author zyb
 * @date 2022-01-02
 */
@Service
public class LPaymethodServiceImpl extends ServiceImpl<LPaymethodMapper, LPaymethod> implements ILPaymethodService {

    /**
     * 查询支付
     *
     * @param payid 支付主键
     * @return 支付
     */
    @Override
    public LPaymethod selectLPaymethodByPayid(Long payid) {
        return baseMapper.selectLPaymethodByPayid(payid);
    }

    /**
     * 查询支付列表
     *
     * @param lPaymethod 支付
     * @return 支付
     */
    @Override
    public List<LPaymethod> selectLPaymethodList(LPaymethod lPaymethod) {
        return baseMapper.selectLPaymethodList(lPaymethod);
    }

    /**
     * 新增支付
     *
     * @param lPaymethod 支付
     * @return 结果
     */
    @Override
    public int insertLPaymethod(LPaymethod lPaymethod) {
        lPaymethod.setCreateBy(String.valueOf(getUserId()));
        lPaymethod.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertLPaymethod(lPaymethod);
    }

    /**
     * 修改支付
     *
     * @param lPaymethod 支付
     * @return 结果
     */
    @Override
    public int updateLPaymethod(LPaymethod lPaymethod) {
        lPaymethod.setUpdateBy(String.valueOf(getUserId()));
        lPaymethod.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateLPaymethod(lPaymethod);
    }

    /**
     * 批量删除支付
     *
     * @param payids 需要删除的支付主键
     * @return 结果
     */
    @Override
    public int deleteLPaymethodByPayids(Long[] payids) {
        return baseMapper.deleteLPaymethodByPayids(payids);
    }

    /**
     * 删除支付信息
     *
     * @param payid 支付主键
     * @return 结果
     */
    @Override
    public int deleteLPaymethodByPayid(Long payid) {
        return baseMapper.deleteLPaymethodByPayid(payid);
    }
}
